Sample App: Me Chatbot

Medical App: DRR

Drr_ Health Recommendation App with GPT4

DRR Output

My Sample Chatbot App

Here’s the short Python code that I hooked into my sample Flask app.

PROTO.LIFE Chat: ask questions about Richard’s writing

This app assumes you have already indexed your text documents like this:

# Construct a simple vector index
index = GPTSimpleVectorIndex(documents)
# Import necessary packages
from llama_index import GPTSimpleVectorIndex, Document, SimpleDirectoryReader
import os

import openai
# import llama_index

import configparser

config = configparser.ConfigParser()
config.read('config.ini')

openai_api_key = config.get('api_credentials', 'OPENAI_API_KEY')

# Load the index from your saved index.json file
index = GPTSimpleVectorIndex.load_from_disk('./data/neolifespragueindex.json')

## Ask Questions
# response = index.query("should I get a continuous glucose monitor?")
# print(response)

def respond_to_query(query, index_file):
    # index = GPTSimpleVectorIndex.load_from_disk(index_file)
    response = index.query(query)
    return(response)

Inspired by this post on Medium by Guodong Zhao (paywalled) a step-by-step guide to build a chatbot for your own documents (copy on Evernote)